/*
 * @Author: your name
 * @Date: 2022-04-08 22:44:17
 * @LastEditTime: 2022-04-18 22:20:12
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \react-antd-admin\vue-admin-template\src\api\article.js
 */
import request from '@/utils/request'

// 分页获取所有文章
export function getAllArticles(data) {
  return request({
    url: '/article/findAllArticles',
    method: 'get',
    params: data
  })
}
// 根据id获取文章
export function getArticle(data) {
  return request({
    url: '/article/findArticleById',
    method: 'post',
    data
  })
}
// 添加文章
export function createArticle(data) {
  return request({
    url: '/article/createArticle',
    method: 'post',
    data
  })
}
// 删除文章
export function deleteArticle(data) {
  return request({
    url: '/article/deleteArticleById',
    method: 'delete',
    data
  })
}
// 修改文章
export function updateArticle(data) {
  return request({
    url: '/article/updateArticleById',
    method: 'post',
    data
  })
}
// 审核文章
export function checkArticle(data) {
  return request({
    url: '/article/checkArticle',
    method: 'post',
    data
  })
}
// 点赞
export function thumpUpArticle(id) {
  return request({
    url: '/article/thumpUpArticle',
    method: 'get',
    params: { id }
  })
}

export function readTime(id) {
  return request({
    url: '/article/readTime',
    method: 'get',
    params: { id }
  })
}